package initialize

import (
	"gin-simple/global"
	"gin-simple/middleware"
	"gin-simple/router/user"
	"net/http"

	"github.com/gin-gonic/gin"
)

func Routers() *gin.Engine {
	Router := gin.Default()

	//Router.StaticFS(global.CONFIG.Local.StorePath, http.Dir(global.CONFIG.Local.StorePath))
	Router.Use(middleware.Cors())
	BaseRouterGroup := Router.Group(global.CONFIG.System.RouterPrefix)
	{

		BaseRouterGroup.GET("/health", func(c *gin.Context) {
			c.JSON(http.StatusOK, "ok")
		})
		user.InitUserLoginRouter(BaseRouterGroup)
	}

	global.LOG.Info("router register success")
	return Router
}
